/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('cloudcallcenter', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model CampaignDetail {
  actualEndTime?: long(name='ActualEndTime'),
  actualStartTime?: long(name='ActualStartTime'),
  casesAborted?: long(name='CasesAborted'),
  casesConnected?: long(name='CasesConnected'),
  casesUncompleted?: long(name='CasesUncompleted'),
  completedRate?: long(name='CompletedRate'),
  createTime?: long(name='CreateTime'),
  id?: string(name='Id'),
  maxAttemptCount?: long(name='MaxAttemptCount'),
  minAttemptInterval?: long(name='MinAttemptInterval'),
  name?: string(name='Name'),
  planedEndTime?: long(name='PlanedEndTime'),
  planedStartTime?: long(name='PlanedStartTime'),
  queueName?: string(name='QueueName'),
  state?: string(name='State'),
  totalCases?: long(name='TotalCases'),
  updateTime?: long(name='UpdateTime'),
}

model AbortCampaignRequest {
  campaignId?: string(name='CampaignId'),
  instanceId?: string(name='InstanceId'),
}

model AbortCampaignResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: string(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model AbortCampaignResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AbortCampaignResponseBody(name='body'),
}

async function abortCampaignWithOptions(request: AbortCampaignRequest, runtime: Util.RuntimeOptions): AbortCampaignResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.campaignId)) {
    query['CampaignId'] = request.campaignId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AbortCampaign',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function abortCampaign(request: AbortCampaignRequest): AbortCampaignResponse {
  var runtime = new Util.RuntimeOptions{};
  return abortCampaignWithOptions(request, runtime);
}

model AbortCasesRequest {
  campaignId?: string(name='CampaignId'),
  instanceId?: string(name='InstanceId'),
  phoneNumberList?: [ string ](name='PhoneNumberList'),
}

model AbortCasesShrinkRequest {
  campaignId?: string(name='CampaignId'),
  instanceId?: string(name='InstanceId'),
  phoneNumberListShrink?: string(name='PhoneNumberList'),
}

model AbortCasesResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: string(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model AbortCasesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AbortCasesResponseBody(name='body'),
}

async function abortCasesWithOptions(tmpReq: AbortCasesRequest, runtime: Util.RuntimeOptions): AbortCasesResponse {
  Util.validateModel(tmpReq);
  var request = new AbortCasesShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.phoneNumberList)) {
    request.phoneNumberListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.phoneNumberList, 'PhoneNumberList', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.campaignId)) {
    query['CampaignId'] = request.campaignId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.phoneNumberListShrink)) {
    query['PhoneNumberList'] = request.phoneNumberListShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AbortCases',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function abortCases(request: AbortCasesRequest): AbortCasesResponse {
  var runtime = new Util.RuntimeOptions{};
  return abortCasesWithOptions(request, runtime);
}

model CheckDemoInstanceExistsResponseBody = {
  code?: string(name='Code'),
  data?: boolean(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  params?: [ string ](name='Params'),
  requestId?: string(name='RequestId'),
}

model CheckDemoInstanceExistsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CheckDemoInstanceExistsResponseBody(name='body'),
}

async function checkDemoInstanceExistsWithOptions(runtime: Util.RuntimeOptions): CheckDemoInstanceExistsResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'CheckDemoInstanceExists',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function checkDemoInstanceExists(): CheckDemoInstanceExistsResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkDemoInstanceExistsWithOptions(runtime);
}

model CheckMQRoleAssumptionAuthorityResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  params?: [ string ](name='Params'),
  requestId?: string(name='RequestId'),
}

model CheckMQRoleAssumptionAuthorityResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CheckMQRoleAssumptionAuthorityResponseBody(name='body'),
}

async function checkMQRoleAssumptionAuthorityWithOptions(runtime: Util.RuntimeOptions): CheckMQRoleAssumptionAuthorityResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'CheckMQRoleAssumptionAuthority',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function checkMQRoleAssumptionAuthority(): CheckMQRoleAssumptionAuthorityResponse {
  var runtime = new Util.RuntimeOptions{};
  return checkMQRoleAssumptionAuthorityWithOptions(runtime);
}

model CreateCampaignRequest {
  callableTime?: string(name='CallableTime'),
  caseFileKey?: string(name='CaseFileKey'),
  caseList?: [ 
    {
      customVariables?: string(name='CustomVariables'),
      phoneNumber?: string(name='PhoneNumber'),
      referenceId?: string(name='ReferenceId'),
    }
  ](name='CaseList'),
  contactFlowId?: string(name='ContactFlowId'),
  endTime?: string(name='EndTime'),
  executingUntilTimeout?: boolean(name='ExecutingUntilTimeout'),
  instanceId?: string(name='InstanceId'),
  maxAttemptCount?: long(name='MaxAttemptCount'),
  minAttemptInterval?: long(name='MinAttemptInterval'),
  name?: string(name='Name'),
  queueId?: string(name='QueueId'),
  simulation?: boolean(name='Simulation'),
  simulationParameters?: string(name='SimulationParameters'),
  startTime?: string(name='StartTime'),
  strategyParameters?: string(name='StrategyParameters'),
  strategyType?: string(name='StrategyType'),
}

model CreateCampaignShrinkRequest {
  callableTime?: string(name='CallableTime'),
  caseFileKey?: string(name='CaseFileKey'),
  caseListShrink?: string(name='CaseList'),
  contactFlowId?: string(name='ContactFlowId'),
  endTime?: string(name='EndTime'),
  executingUntilTimeout?: boolean(name='ExecutingUntilTimeout'),
  instanceId?: string(name='InstanceId'),
  maxAttemptCount?: long(name='MaxAttemptCount'),
  minAttemptInterval?: long(name='MinAttemptInterval'),
  name?: string(name='Name'),
  queueId?: string(name='QueueId'),
  simulation?: boolean(name='Simulation'),
  simulationParameters?: string(name='SimulationParameters'),
  startTime?: string(name='StartTime'),
  strategyParameters?: string(name='StrategyParameters'),
  strategyType?: string(name='StrategyType'),
}

model CreateCampaignResponseBody = {
  campaignId?: string(name='CampaignId'),
  code?: string(name='Code'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model CreateCampaignResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateCampaignResponseBody(name='body'),
}

async function createCampaignWithOptions(tmpReq: CreateCampaignRequest, runtime: Util.RuntimeOptions): CreateCampaignResponse {
  Util.validateModel(tmpReq);
  var request = new CreateCampaignShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.caseList)) {
    request.caseListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.caseList, 'CaseList', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.callableTime)) {
    query['CallableTime'] = request.callableTime;
  }
  if (!Util.isUnset(request.caseFileKey)) {
    query['CaseFileKey'] = request.caseFileKey;
  }
  if (!Util.isUnset(request.caseListShrink)) {
    query['CaseList'] = request.caseListShrink;
  }
  if (!Util.isUnset(request.contactFlowId)) {
    query['ContactFlowId'] = request.contactFlowId;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.executingUntilTimeout)) {
    query['ExecutingUntilTimeout'] = request.executingUntilTimeout;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.maxAttemptCount)) {
    query['MaxAttemptCount'] = request.maxAttemptCount;
  }
  if (!Util.isUnset(request.minAttemptInterval)) {
    query['MinAttemptInterval'] = request.minAttemptInterval;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.queueId)) {
    query['QueueId'] = request.queueId;
  }
  if (!Util.isUnset(request.simulation)) {
    query['Simulation'] = request.simulation;
  }
  if (!Util.isUnset(request.simulationParameters)) {
    query['SimulationParameters'] = request.simulationParameters;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.strategyParameters)) {
    query['StrategyParameters'] = request.strategyParameters;
  }
  if (!Util.isUnset(request.strategyType)) {
    query['StrategyType'] = request.strategyType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateCampaign',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createCampaign(request: CreateCampaignRequest): CreateCampaignResponse {
  var runtime = new Util.RuntimeOptions{};
  return createCampaignWithOptions(request, runtime);
}

model CreateCorpNumberGroupRequest {
  description?: string(name='Description'),
  name?: string(name='Name'),
}

model CreateCorpNumberGroupResponseBody = {
  code?: string(name='Code'),
  data?: {
    aliyunUid?: string(name='AliyunUid'),
    description?: string(name='Description'),
    numberCount?: string(name='NumberCount'),
    numberGroupId?: string(name='NumberGroupId'),
    numberGroupName?: string(name='NumberGroupName'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model CreateCorpNumberGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateCorpNumberGroupResponseBody(name='body'),
}

async function createCorpNumberGroupWithOptions(request: CreateCorpNumberGroupRequest, runtime: Util.RuntimeOptions): CreateCorpNumberGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateCorpNumberGroup',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createCorpNumberGroup(request: CreateCorpNumberGroupRequest): CreateCorpNumberGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return createCorpNumberGroupWithOptions(request, runtime);
}

model CreateDemoInstanceRequest {
  outboundCallWhitelist?: string(name='OutboundCallWhitelist'),
}

model CreateDemoInstanceResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  params?: [ string ](name='Params'),
  requestId?: string(name='RequestId'),
}

model CreateDemoInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateDemoInstanceResponseBody(name='body'),
}

async function createDemoInstanceWithOptions(request: CreateDemoInstanceRequest, runtime: Util.RuntimeOptions): CreateDemoInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.outboundCallWhitelist)) {
    query['OutboundCallWhitelist'] = request.outboundCallWhitelist;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateDemoInstance',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createDemoInstance(request: CreateDemoInstanceRequest): CreateDemoInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return createDemoInstanceWithOptions(request, runtime);
}

model GetAccessChannelOfStagingRequest {
  searchPattern?: string(name='SearchPattern'),
}

model GetAccessChannelOfStagingResponseBody = {
  code?: string(name='Code'),
  data?: {
    token?: string(name='Token'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model GetAccessChannelOfStagingResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetAccessChannelOfStagingResponseBody(name='body'),
}

async function getAccessChannelOfStagingWithOptions(request: GetAccessChannelOfStagingRequest, runtime: Util.RuntimeOptions): GetAccessChannelOfStagingResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetAccessChannelOfStaging',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getAccessChannelOfStaging(request: GetAccessChannelOfStagingRequest): GetAccessChannelOfStagingResponse {
  var runtime = new Util.RuntimeOptions{};
  return getAccessChannelOfStagingWithOptions(request, runtime);
}

model GetCampaignRequest {
  campaignId?: string(name='CampaignId'),
  instanceId?: string(name='InstanceId'),
}

model GetCampaignResponseBody = {
  code?: string(name='Code'),
  data?: {
    actualEndTime?: long(name='ActualEndTime'),
    actualStartTime?: long(name='ActualStartTime'),
    campaignId?: string(name='CampaignId'),
    casesAborted?: long(name='CasesAborted'),
    casesConnected?: long(name='CasesConnected'),
    casesUncompleted?: long(name='CasesUncompleted'),
    completedRate?: long(name='CompletedRate'),
    maxAttemptCount?: long(name='MaxAttemptCount'),
    minAttemptInterval?: long(name='MinAttemptInterval'),
    name?: string(name='Name'),
    planedEndTime?: long(name='PlanedEndTime'),
    planedStartTime?: long(name='PlanedStartTime'),
    queueId?: string(name='QueueId'),
    queueName?: string(name='QueueName'),
    simulation?: boolean(name='Simulation'),
    simulationParameters?: string(name='SimulationParameters'),
    state?: string(name='State'),
    strategyParameters?: string(name='StrategyParameters'),
    strategyType?: string(name='StrategyType'),
    totalCases?: long(name='TotalCases'),
  }(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetCampaignResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetCampaignResponseBody(name='body'),
}

async function getCampaignWithOptions(request: GetCampaignRequest, runtime: Util.RuntimeOptions): GetCampaignResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.campaignId)) {
    query['CampaignId'] = request.campaignId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetCampaign',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getCampaign(request: GetCampaignRequest): GetCampaignResponse {
  var runtime = new Util.RuntimeOptions{};
  return getCampaignWithOptions(request, runtime);
}

model GetHistoricalCampaignReportRequest {
  campaignId?: string(name='CampaignId', example='111'),
  instanceId?: string(name='InstanceId', example='111'),
}

model GetHistoricalCampaignReportResponseBody = {
  code?: string(name='Code'),
  data?: {
    abandonedRate?: float(name='AbandonedRate'),
    callsAbandoned?: long(name='CallsAbandoned'),
    callsConnected?: long(name='CallsConnected'),
    callsDialed?: long(name='CallsDialed'),
    connectedRate?: float(name='ConnectedRate'),
    occupancyRate?: float(name='OccupancyRate'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model GetHistoricalCampaignReportResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetHistoricalCampaignReportResponseBody(name='body'),
}

async function getHistoricalCampaignReportWithOptions(request: GetHistoricalCampaignReportRequest, runtime: Util.RuntimeOptions): GetHistoricalCampaignReportResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetHistoricalCampaignReport',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getHistoricalCampaignReport(request: GetHistoricalCampaignReportRequest): GetHistoricalCampaignReportResponse {
  var runtime = new Util.RuntimeOptions{};
  return getHistoricalCampaignReportWithOptions(request, runtime);
}

model GetInstanceIdsByAliyunUidV2Request {
  aliyunUid?: string(name='AliyunUid'),
}

model GetInstanceIdsByAliyunUidV2ResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: long(name='HttpStatusCode'),
  instanceIds?: [ string ](name='InstanceIds'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetInstanceIdsByAliyunUidV2Response = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetInstanceIdsByAliyunUidV2ResponseBody(name='body'),
}

async function getInstanceIdsByAliyunUidV2WithOptions(request: GetInstanceIdsByAliyunUidV2Request, runtime: Util.RuntimeOptions): GetInstanceIdsByAliyunUidV2Response {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.aliyunUid)) {
    query['AliyunUid'] = request.aliyunUid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetInstanceIdsByAliyunUidV2',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getInstanceIdsByAliyunUidV2(request: GetInstanceIdsByAliyunUidV2Request): GetInstanceIdsByAliyunUidV2Response {
  var runtime = new Util.RuntimeOptions{};
  return getInstanceIdsByAliyunUidV2WithOptions(request, runtime);
}

model GetRealtimeCampaignStatsRequest {
  instanceId?: string(name='InstanceId', example='111'),
  queueId?: string(name='QueueId', example='111'),
}

model GetRealtimeCampaignStatsResponseBody = {
  code?: string(name='Code'),
  data?: {
    breakingAgents?: long(name='BreakingAgents'),
    caps?: long(name='Caps'),
    loggedInAgents?: long(name='LoggedInAgents'),
    outboundScenarioBreakingAgents?: long(name='OutboundScenarioBreakingAgents'),
    outboundScenarioReadyAgents?: long(name='OutboundScenarioReadyAgents'),
    outboundScenarioTalkingAgents?: long(name='OutboundScenarioTalkingAgents'),
    outboundScenarioWorkingAgents?: long(name='OutboundScenarioWorkingAgents'),
    readyAgents?: long(name='ReadyAgents'),
    talkingAgents?: long(name='TalkingAgents'),
    totalAgents?: long(name='TotalAgents'),
    workingAgents?: long(name='WorkingAgents'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model GetRealtimeCampaignStatsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetRealtimeCampaignStatsResponseBody(name='body'),
}

async function getRealtimeCampaignStatsWithOptions(request: GetRealtimeCampaignStatsRequest, runtime: Util.RuntimeOptions): GetRealtimeCampaignStatsResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetRealtimeCampaignStats',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getRealtimeCampaignStats(request: GetRealtimeCampaignStatsRequest): GetRealtimeCampaignStatsResponse {
  var runtime = new Util.RuntimeOptions{};
  return getRealtimeCampaignStatsWithOptions(request, runtime);
}

model ImportAdminsRequest {
  instanceId?: string(name='InstanceId'),
  ramIdList?: string(name='RamIdList'),
}

model ImportAdminsResponseBody = {
  code?: string(name='Code'),
  data?: [ 
    {
      extension?: string(name='Extension'),
      instanceId?: string(name='InstanceId'),
      ramId?: string(name='RamId'),
      roleId?: string(name='RoleId'),
      userId?: string(name='UserId'),
    }
  ](name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model ImportAdminsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ImportAdminsResponseBody(name='body'),
}

async function importAdminsWithOptions(request: ImportAdminsRequest, runtime: Util.RuntimeOptions): ImportAdminsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ramIdList)) {
    query['RamIdList'] = request.ramIdList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ImportAdmins',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function importAdmins(request: ImportAdminsRequest): ImportAdminsResponse {
  var runtime = new Util.RuntimeOptions{};
  return importAdminsWithOptions(request, runtime);
}

model IssueSoftphoneCommandRequest {
  data?: string(name='Data'),
}

model IssueSoftphoneCommandResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model IssueSoftphoneCommandResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: IssueSoftphoneCommandResponseBody(name='body'),
}

async function issueSoftphoneCommandWithOptions(request: IssueSoftphoneCommandRequest, runtime: Util.RuntimeOptions): IssueSoftphoneCommandResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.data)) {
    query['Data'] = request.data;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'IssueSoftphoneCommand',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function issueSoftphoneCommand(request: IssueSoftphoneCommandRequest): IssueSoftphoneCommandResponse {
  var runtime = new Util.RuntimeOptions{};
  return issueSoftphoneCommandWithOptions(request, runtime);
}

model ListAttemptsRequest {
  agentId?: string(name='AgentId', example='111'),
  attemptId?: string(name='AttemptId', example='111'),
  callee?: string(name='Callee', example='111'),
  caller?: string(name='Caller', example='111'),
  campaignId?: string(name='CampaignId', example='111'),
  caseId?: string(name='CaseId', example='1111'),
  contactId?: string(name='ContactId', example='111'),
  endTime?: long(name='EndTime', example='1111'),
  instanceId?: string(name='InstanceId', example='111'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
  queueId?: string(name='QueueId', example='111'),
  startTime?: long(name='StartTime', example='111'),
}

model ListAttemptsResponseBody = {
  code?: string(name='Code'),
  data?: {
    list?: [ 
      {
        agentEstablishedTime?: long(name='AgentEstablishedTime'),
        agentId?: string(name='AgentId'),
        agentRingDuration?: long(name='AgentRingDuration'),
        assignAgentTime?: long(name='AssignAgentTime'),
        attemptId?: string(name='AttemptId'),
        callee?: string(name='Callee'),
        caller?: string(name='Caller'),
        campaignId?: string(name='CampaignId'),
        caseId?: string(name='CaseId'),
        contactId?: string(name='ContactId'),
        customerEstablishedTime?: long(name='CustomerEstablishedTime'),
        customerReleasedTime?: long(name='CustomerReleasedTime'),
        dialDuration?: long(name='DialDuration'),
        dialTime?: long(name='DialTime'),
        enqueueTime?: long(name='EnqueueTime'),
        enterIvrTime?: long(name='EnterIvrTime'),
        instanceId?: string(name='InstanceId'),
        ivrDuration?: long(name='IvrDuration'),
        queueDuration?: long(name='QueueDuration'),
        queueId?: string(name='QueueId'),
      }
    ](name='List'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model ListAttemptsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListAttemptsResponseBody(name='body'),
}

async function listAttemptsWithOptions(request: ListAttemptsRequest, runtime: Util.RuntimeOptions): ListAttemptsResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAttempts',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listAttempts(request: ListAttemptsRequest): ListAttemptsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listAttemptsWithOptions(request, runtime);
}

model ListCampaignTrendingReportRequest {
  campaignId?: string(name='CampaignId', example='111'),
  endTime?: long(name='EndTime', example='1111'),
  instanceId?: string(name='InstanceId', example='111'),
  startTime?: long(name='StartTime', example='111'),
}

model ListCampaignTrendingReportResponseBody = {
  code?: string(name='Code'),
  data?: [ 
    {
      breakAgents?: long(name='BreakAgents'),
      concurrency?: long(name='Concurrency'),
      datetime?: long(name='Datetime'),
      loggedInAgents?: long(name='LoggedInAgents'),
      outboundScenarioBreakingAgents?: string(name='OutboundScenarioBreakingAgents'),
      outboundScenarioReadyAgents?: string(name='OutboundScenarioReadyAgents'),
      outboundScenarioTalkingAgents?: string(name='OutboundScenarioTalkingAgents'),
      outboundScenarioWorkingAgents?: string(name='OutboundScenarioWorkingAgents'),
      readyAgents?: long(name='ReadyAgents'),
      talkAgents?: long(name='TalkAgents'),
      workAgents?: long(name='WorkAgents'),
    }
  ](name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model ListCampaignTrendingReportResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListCampaignTrendingReportResponseBody(name='body'),
}

async function listCampaignTrendingReportWithOptions(request: ListCampaignTrendingReportRequest, runtime: Util.RuntimeOptions): ListCampaignTrendingReportResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListCampaignTrendingReport',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listCampaignTrendingReport(request: ListCampaignTrendingReportRequest): ListCampaignTrendingReportResponse {
  var runtime = new Util.RuntimeOptions{};
  return listCampaignTrendingReportWithOptions(request, runtime);
}

model ListCampaignsRequest {
  actualStartTimeFrom?: string(name='ActualStartTimeFrom'),
  actualStartTimeTo?: string(name='ActualStartTimeTo'),
  instanceId?: string(name='InstanceId'),
  name?: string(name='Name'),
  pageNumber?: long(name='PageNumber'),
  pageSize?: long(name='PageSize'),
  planedStartTimeFrom?: string(name='PlanedStartTimeFrom'),
  planedStartTimeTo?: string(name='PlanedStartTimeTo'),
  queueId?: string(name='QueueId'),
  state?: string(name='State'),
}

model ListCampaignsResponseBody = {
  code?: string(name='Code'),
  data?: {
    list?: [ 
      {
        actualEndTime?: long(name='ActualEndTime'),
        actualStartTime?: long(name='ActualStartTime'),
        campaignId?: string(name='CampaignId'),
        casesAborted?: long(name='CasesAborted'),
        casesConnected?: long(name='CasesConnected'),
        casesUncompleted?: long(name='CasesUncompleted'),
        completedRate?: long(name='CompletedRate'),
        maxAttemptCount?: long(name='MaxAttemptCount'),
        minAttemptInterval?: long(name='MinAttemptInterval'),
        name?: string(name='Name'),
        planedEndTime?: long(name='PlanedEndTime'),
        planedStartTime?: long(name='PlanedStartTime'),
        queueId?: string(name='QueueId'),
        queueName?: string(name='QueueName'),
        simulation?: boolean(name='Simulation'),
        state?: string(name='State'),
        strategyParameters?: string(name='StrategyParameters'),
        strategyType?: string(name='StrategyType'),
        totalCases?: long(name='TotalCases'),
      }
    ](name='List'),
    pageNumber?: long(name='PageNumber'),
    pageSize?: long(name='PageSize'),
    totalCount?: long(name='TotalCount'),
  }(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListCampaignsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListCampaignsResponseBody(name='body'),
}

async function listCampaignsWithOptions(request: ListCampaignsRequest, runtime: Util.RuntimeOptions): ListCampaignsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.actualStartTimeFrom)) {
    query['ActualStartTimeFrom'] = request.actualStartTimeFrom;
  }
  if (!Util.isUnset(request.actualStartTimeTo)) {
    query['ActualStartTimeTo'] = request.actualStartTimeTo;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.planedStartTimeFrom)) {
    query['PlanedStartTimeFrom'] = request.planedStartTimeFrom;
  }
  if (!Util.isUnset(request.planedStartTimeTo)) {
    query['PlanedStartTimeTo'] = request.planedStartTimeTo;
  }
  if (!Util.isUnset(request.queueId)) {
    query['QueueId'] = request.queueId;
  }
  if (!Util.isUnset(request.state)) {
    query['State'] = request.state;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListCampaigns',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listCampaigns(request: ListCampaignsRequest): ListCampaignsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listCampaignsWithOptions(request, runtime);
}

model ListCasesRequest {
  campaignId?: string(name='CampaignId'),
  instanceId?: string(name='InstanceId'),
  pageNumber?: long(name='PageNumber'),
  pageSize?: long(name='PageSize'),
  phoneNumber?: string(name='PhoneNumber'),
}

model ListCasesResponseBody = {
  code?: string(name='Code'),
  data?: {
    list?: [ 
      {
        abandonType?: string(name='AbandonType'),
        attemptCount?: long(name='AttemptCount'),
        caseId?: string(name='CaseId'),
        customVariables?: string(name='CustomVariables'),
        expandInfo?: string(name='ExpandInfo'),
        failureReason?: string(name='FailureReason'),
        phoneNumber?: string(name='PhoneNumber'),
        state?: string(name='State'),
      }
    ](name='List'),
    pageNumber?: long(name='PageNumber'),
    pageSize?: long(name='PageSize'),
    totalCount?: long(name='TotalCount'),
  }(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListCasesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListCasesResponseBody(name='body'),
}

async function listCasesWithOptions(request: ListCasesRequest, runtime: Util.RuntimeOptions): ListCasesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.campaignId)) {
    query['CampaignId'] = request.campaignId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListCases',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listCases(request: ListCasesRequest): ListCasesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listCasesWithOptions(request, runtime);
}

model ListHistoricalAgentSkillGroupReportRequest {
  agentIdList?: string(name='AgentIdList', example='["agent1@ccc-test", "agent2@ccc-test"]'),
  endTime?: long(name='EndTime', example='1657728000000'),
  instanceId?: string(name='InstanceId', example='ccc-test'),
  mediaType?: string(name='MediaType'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  skillGroupIdList?: string(name='SkillGroupIdList', example='["skg1@ccc-test", "skg2@ccc-test"]'),
  startTime?: long(name='StartTime', example='1671242400000'),
}

model ListHistoricalAgentSkillGroupReportResponseBody = {
  code?: string(name='Code', example='OK'),
  data?: {
    list?: [ 
      {
        agentId?: string(name='AgentId', example='agent1@ccc-test'),
        agentName?: string(name='AgentName'),
        back2Back?: {
          agentAnswerRate?: float(name='AgentAnswerRate', example='0.5'),
          answerRate?: float(name='AnswerRate', example='0.5'),
          averageCustomerRingTime?: float(name='AverageCustomerRingTime', example='100'),
          averageRingTime?: float(name='AverageRingTime', example='100'),
          averageTalkTime?: long(name='AverageTalkTime', example='100'),
          callsAnswered?: long(name='CallsAnswered', example='10'),
          callsCustomerHandled?: long(name='CallsCustomerHandled', example='100'),
          callsDialed?: long(name='CallsDialed', example='10'),
          customerHandleRate?: float(name='CustomerHandleRate', example='0.5'),
          maxCustomerRingTime?: long(name='MaxCustomerRingTime', example='100'),
          maxRingTime?: long(name='MaxRingTime', example='100'),
          maxTalkTime?: long(name='MaxTalkTime', example='100'),
          totalCustomerRingTime?: long(name='TotalCustomerRingTime', example='100'),
          totalRingTime?: long(name='TotalRingTime', example='100'),
          totalTalkTime?: long(name='TotalTalkTime', example='100'),
        }(name='Back2Back'),
        displayId?: string(name='DisplayId', example='123'),
        inbound?: {
          averageFirstResponseTime?: float(name='AverageFirstResponseTime'),
          averageHoldTime?: float(name='AverageHoldTime', example='100'),
          averageResponseTime?: float(name='AverageResponseTime'),
          averageRingTime?: float(name='AverageRingTime', example='100'),
          averageTalkTime?: float(name='AverageTalkTime', example='100'),
          averageWorkTime?: float(name='AverageWorkTime', example='100'),
          callsAttendedTransferIn?: long(name='CallsAttendedTransferIn', example='10'),
          callsAttendedTransferOut?: long(name='CallsAttendedTransferOut', example='10'),
          callsBlindTransferIn?: long(name='CallsBlindTransferIn', example='10'),
          callsBlindTransferOut?: long(name='CallsBlindTransferOut', example='10'),
          callsHandled?: long(name='CallsHandled', example='10'),
          callsHold?: long(name='CallsHold', example='10'),
          callsOffered?: long(name='CallsOffered', example='10'),
          callsRinged?: long(name='CallsRinged', example='10'),
          handleRate?: float(name='HandleRate', example='0.5'),
          maxHoldTime?: long(name='MaxHoldTime', example='100'),
          maxRingTime?: long(name='MaxRingTime', example='100'),
          maxTalkTime?: long(name='MaxTalkTime', example='100'),
          maxWorkTime?: long(name='MaxWorkTime', example='100'),
          satisfactionIndex?: float(name='SatisfactionIndex', example='1.4'),
          satisfactionRate?: float(name='SatisfactionRate', example='100'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered', example='10'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded', example='10'),
          totalHoldTime?: long(name='TotalHoldTime', example='100'),
          totalMessagesSent?: long(name='TotalMessagesSent'),
          totalMessagesSentByAgent?: long(name='TotalMessagesSentByAgent'),
          totalMessagesSentByCustomer?: long(name='TotalMessagesSentByCustomer'),
          totalRingTime?: long(name='TotalRingTime', example='100'),
          totalTalkTime?: long(name='TotalTalkTime', example='100'),
          totalWorkTime?: long(name='TotalWorkTime', example='100'),
        }(name='Inbound'),
        internal?: {
          averageTalkTime?: long(name='AverageTalkTime', example='100'),
          callsAnswered?: long(name='CallsAnswered', example='10'),
          callsDialed?: long(name='CallsDialed', example='10'),
          callsHandled?: long(name='CallsHandled', example='10'),
          callsOffered?: long(name='CallsOffered', example='10'),
          callsTalk?: long(name='CallsTalk', example='10'),
          maxTalkTime?: long(name='MaxTalkTime', example='100'),
          totalTalkTime?: long(name='TotalTalkTime', example='100'),
        }(name='Internal'),
        outbound?: {
          answerRate?: float(name='AnswerRate', example='0.4'),
          averageDialingTime?: float(name='AverageDialingTime', example='100'),
          averageHoldTime?: float(name='AverageHoldTime', example='100'),
          averageRingTime?: float(name='AverageRingTime', example='100'),
          averageTalkTime?: float(name='AverageTalkTime', example='100'),
          averageWorkTime?: float(name='AverageWorkTime', example='100'),
          callsAnswered?: long(name='CallsAnswered', example='10'),
          callsAttendedTransferIn?: long(name='CallsAttendedTransferIn', example='10'),
          callsAttendedTransferOut?: long(name='CallsAttendedTransferOut', example='10'),
          callsBlindTransferIn?: long(name='CallsBlindTransferIn', example='10'),
          callsBlindTransferOut?: long(name='CallsBlindTransferOut', example='10'),
          callsDialed?: long(name='CallsDialed', example='10'),
          callsHold?: long(name='CallsHold', example='10'),
          callsRinged?: long(name='CallsRinged', example='10'),
          maxDialingTime?: long(name='MaxDialingTime', example='100'),
          maxHoldTime?: long(name='MaxHoldTime', example='100'),
          maxRingTime?: long(name='MaxRingTime', example='100'),
          maxTalkTime?: long(name='MaxTalkTime', example='100'),
          maxWorkTime?: long(name='MaxWorkTime', example='100'),
          satisfactionIndex?: float(name='SatisfactionIndex', example='1.5'),
          satisfactionRate?: float(name='SatisfactionRate', example='0.5'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered', example='10'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded', example='10'),
          totalDialingTime?: long(name='TotalDialingTime', example='100'),
          totalHoldTime?: long(name='TotalHoldTime', example='100'),
          totalRingTime?: long(name='TotalRingTime', example='100'),
          totalTalkTime?: long(name='TotalTalkTime', example='100'),
          totalWorkTime?: long(name='TotalWorkTime', example='100'),
        }(name='Outbound'),
        overall?: {
          averageBreakTime?: float(name='AverageBreakTime', example='100'),
          averageHoldTime?: float(name='AverageHoldTime', example='100'),
          averageReadyTime?: float(name='AverageReadyTime', example='100'),
          averageTalkTime?: float(name='AverageTalkTime', example='100'),
          averageWorkTime?: float(name='AverageWorkTime', example='100'),
          breakCodeDetailList?: [ 
            {
              breakCode?: string(name='BreakCode'),
              count?: long(name='Count', example='100'),
              duration?: long(name='Duration', example='100'),
            }
          ](name='BreakCodeDetailList'),
          firstCheckInTime?: long(name='FirstCheckInTime', example='1686030515000'),
          lastCheckOutTime?: long(name='LastCheckOutTime', example='1686030515000'),
          maxBreakTime?: long(name='MaxBreakTime', example='100'),
          maxHoldTime?: long(name='MaxHoldTime', example='100'),
          maxReadyTime?: long(name='MaxReadyTime', example='100'),
          maxTalkTime?: long(name='MaxTalkTime', example='100'),
          maxWorkTime?: long(name='MaxWorkTime', example='100'),
          occupancyRate?: float(name='OccupancyRate', example='0.1'),
          satisfactionIndex?: float(name='SatisfactionIndex', example='1.4'),
          satisfactionRate?: float(name='SatisfactionRate', example='100'),
          satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered', example='10'),
          satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded', example='10'),
          totalBreakTime?: long(name='TotalBreakTime', example='100'),
          totalCalls?: long(name='TotalCalls', example='10'),
          totalHoldTime?: long(name='TotalHoldTime', example='100'),
          totalLoggedInTime?: long(name='TotalLoggedInTime', example='100'),
          totalOffSiteOnlineTime?: long(name='TotalOffSiteOnlineTime', example='100'),
          totalOfficePhoneOnlineTime?: long(name='TotalOfficePhoneOnlineTime', example='100'),
          totalOnSiteOnlineTime?: long(name='TotalOnSiteOnlineTime', example='100'),
          totalOutboundScenarioReadyTime?: long(name='TotalOutboundScenarioReadyTime', example='100'),
          totalOutboundScenarioTime?: long(name='TotalOutboundScenarioTime', example='100'),
          totalReadyTime?: long(name='TotalReadyTime', example='100'),
          totalTalkTime?: long(name='TotalTalkTime', example='100'),
          totalWorkTime?: long(name='TotalWorkTime', example='100'),
        }(name='Overall'),
        skillGroupId?: string(name='SkillGroupId', example='skg1@ccc-test'),
        skillGroupName?: string(name='SkillGroupName', example='skg'),
      }
    ](name='List'),
    pageNumber?: int32(name='PageNumber', example='1'),
    pageSize?: int32(name='PageSize', example='10'),
    totalCount?: int32(name='TotalCount', example='13'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', example='FCEFE806-E67C-577E-865B-4ED398F2F648'),
}

model ListHistoricalAgentSkillGroupReportResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListHistoricalAgentSkillGroupReportResponseBody(name='body'),
}

async function listHistoricalAgentSkillGroupReportWithOptions(request: ListHistoricalAgentSkillGroupReportRequest, runtime: Util.RuntimeOptions): ListHistoricalAgentSkillGroupReportResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.mediaType)) {
    query['MediaType'] = request.mediaType;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.skillGroupIdList)) {
    query['SkillGroupIdList'] = request.skillGroupIdList;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.agentIdList)) {
    body['AgentIdList'] = request.agentIdList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ListHistoricalAgentSkillGroupReport',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listHistoricalAgentSkillGroupReport(request: ListHistoricalAgentSkillGroupReportRequest): ListHistoricalAgentSkillGroupReportResponse {
  var runtime = new Util.RuntimeOptions{};
  return listHistoricalAgentSkillGroupReportWithOptions(request, runtime);
}

model ListIntervalAgentSkillGroupReportRequest {
  agentId?: string(name='AgentId', example='agent@ccc-test'),
  endTime?: long(name='EndTime', example='1532707199000'),
  instanceId?: string(name='InstanceId', example='ccc-test'),
  interval?: string(name='Interval', example='Daily'),
  mediaType?: string(name='MediaType'),
  skillGroupId?: string(name='SkillGroupId', example='skg-default@ccc-test'),
  startTime?: long(name='StartTime', example='1532448000000'),
}

model ListIntervalAgentSkillGroupReportResponseBody = {
  code?: string(name='Code', example='OK'),
  data?: [ 
    {
      back2Back?: {
        agentAnswerRate?: float(name='AgentAnswerRate', example='0.4'),
        answerRate?: float(name='AnswerRate', example='0.4'),
        averageCustomerRingTime?: float(name='AverageCustomerRingTime', example='100'),
        averageRingTime?: float(name='AverageRingTime', example='100'),
        averageTalkTime?: long(name='AverageTalkTime', example='100'),
        callsAnswered?: long(name='CallsAnswered', example='10'),
        callsCustomerHandled?: long(name='CallsCustomerHandled', example='10'),
        callsDialed?: long(name='CallsDialed', example='10'),
        customerHandleRate?: float(name='CustomerHandleRate', example='0.4'),
        maxCustomerRingTime?: long(name='MaxCustomerRingTime', example='100'),
        maxRingTime?: long(name='MaxRingTime', example='100'),
        maxTalkTime?: long(name='MaxTalkTime', example='100'),
        totalCustomerRingTime?: long(name='TotalCustomerRingTime', example='100'),
        totalRingTime?: long(name='TotalRingTime', example='100'),
        totalTalkTime?: long(name='TotalTalkTime', example='100'),
      }(name='Back2Back'),
      inbound?: {
        averageFirstResponseTime?: float(name='AverageFirstResponseTime'),
        averageHoldTime?: float(name='AverageHoldTime', example='100'),
        averageResponseTime?: float(name='AverageResponseTime'),
        averageRingTime?: float(name='AverageRingTime', example='100'),
        averageTalkTime?: float(name='AverageTalkTime', example='100'),
        averageWorkTime?: float(name='AverageWorkTime', example='100'),
        callsAttendedTransferIn?: long(name='CallsAttendedTransferIn', example='10'),
        callsAttendedTransferOut?: long(name='CallsAttendedTransferOut', example='10'),
        callsBlindTransferIn?: long(name='CallsBlindTransferIn', example='10'),
        callsBlindTransferOut?: long(name='CallsBlindTransferOut', example='10'),
        callsHandled?: long(name='CallsHandled', example='10'),
        callsHold?: long(name='CallsHold', example='10'),
        callsOffered?: long(name='CallsOffered', example='100'),
        callsRinged?: long(name='CallsRinged', example='10'),
        handleRate?: float(name='HandleRate', example='0.6'),
        maxHoldTime?: long(name='MaxHoldTime', example='100'),
        maxRingTime?: long(name='MaxRingTime', example='100'),
        maxTalkTime?: long(name='MaxTalkTime', example='100'),
        maxWorkTime?: long(name='MaxWorkTime', example='100'),
        satisfactionIndex?: float(name='SatisfactionIndex', example='1.4'),
        satisfactionRate?: float(name='SatisfactionRate', example='0.8'),
        satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered', example='10'),
        satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded', example='10'),
        totalHoldTime?: long(name='TotalHoldTime', example='100'),
        totalMessagesSent?: long(name='TotalMessagesSent'),
        totalMessagesSentByAgent?: long(name='TotalMessagesSentByAgent'),
        totalMessagesSentByCustomer?: long(name='TotalMessagesSentByCustomer'),
        totalRingTime?: long(name='TotalRingTime', example='100'),
        totalTalkTime?: long(name='TotalTalkTime', example='100'),
        totalWorkTime?: long(name='TotalWorkTime', example='100'),
      }(name='Inbound'),
      internal?: {
        averageTalkTime?: float(name='AverageTalkTime', example='100'),
        callsAnswered?: long(name='CallsAnswered', example='10'),
        callsDialed?: long(name='CallsDialed', example='10'),
        callsHandled?: long(name='CallsHandled', example='10'),
        callsOffered?: long(name='CallsOffered', example='10'),
        callsTalk?: long(name='CallsTalk', example='10'),
        maxTalkTime?: long(name='MaxTalkTime', example='100'),
        totalTalkTime?: long(name='TotalTalkTime', example='100'),
      }(name='Internal'),
      outbound?: {
        answerRate?: float(name='AnswerRate', example='0.5'),
        averageDialingTime?: float(name='AverageDialingTime', example='100'),
        averageHoldTime?: float(name='AverageHoldTime', example='100'),
        averageRingTime?: float(name='AverageRingTime', example='100'),
        averageTalkTime?: float(name='AverageTalkTime', example='100'),
        averageWorkTime?: float(name='AverageWorkTime', example='100'),
        callsAnswered?: long(name='CallsAnswered', example='10'),
        callsAttendedTransferIn?: long(name='CallsAttendedTransferIn', example='10'),
        callsAttendedTransferOut?: long(name='CallsAttendedTransferOut', example='100'),
        callsBlindTransferIn?: long(name='CallsBlindTransferIn', example='10'),
        callsBlindTransferOut?: long(name='CallsBlindTransferOut', example='10'),
        callsDialed?: long(name='CallsDialed', example='10'),
        callsHold?: long(name='CallsHold', example='10'),
        callsRinged?: long(name='CallsRinged', example='10'),
        maxDialingTime?: long(name='MaxDialingTime', example='100'),
        maxHoldTime?: long(name='MaxHoldTime', example='100'),
        maxRingTime?: long(name='MaxRingTime', example='100'),
        maxTalkTime?: long(name='MaxTalkTime', example='100'),
        maxWorkTime?: long(name='MaxWorkTime', example='100'),
        satisfactionIndex?: float(name='SatisfactionIndex', example='1.4'),
        satisfactionRate?: float(name='SatisfactionRate', example='0.5'),
        satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered', example='10'),
        satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded', example='10'),
        totalDialingTime?: long(name='TotalDialingTime', example='100'),
        totalHoldTime?: long(name='TotalHoldTime', example='100'),
        totalRingTime?: long(name='TotalRingTime', example='100'),
        totalTalkTime?: long(name='TotalTalkTime', example='100'),
        totalWorkTime?: long(name='TotalWorkTime', example='100'),
      }(name='Outbound'),
      overall?: {
        averageBreakTime?: float(name='AverageBreakTime', example='100'),
        averageHoldTime?: float(name='AverageHoldTime', example='100'),
        averageReadyTime?: float(name='AverageReadyTime', example='100'),
        averageTalkTime?: float(name='AverageTalkTime', example='100'),
        averageWorkTime?: float(name='AverageWorkTime', example='100'),
        breakCodeDetailList?: [ 
          {
            breakCode?: string(name='BreakCode'),
            count?: long(name='Count', example='10'),
            duration?: long(name='Duration', example='100'),
          }
        ](name='BreakCodeDetailList'),
        firstCheckInTime?: long(name='FirstCheckInTime', example='1620291600000'),
        lastCheckoutTime?: long(name='LastCheckoutTime', example='1620291600000'),
        maxBreakTime?: long(name='MaxBreakTime', example='100'),
        maxHoldTime?: long(name='MaxHoldTime', example='100'),
        maxReadyTime?: long(name='MaxReadyTime', example='100'),
        maxTalkTime?: long(name='MaxTalkTime', example='100'),
        maxWorkTime?: long(name='MaxWorkTime', example='100'),
        occupancyRate?: float(name='OccupancyRate', example='0.4'),
        satisfactionIndex?: float(name='SatisfactionIndex', example='1.5'),
        satisfactionRate?: float(name='SatisfactionRate', example='0.4'),
        satisfactionSurveysOffered?: long(name='SatisfactionSurveysOffered', example='10'),
        satisfactionSurveysResponded?: long(name='SatisfactionSurveysResponded', example='10'),
        totalBreakTime?: long(name='TotalBreakTime', example='100'),
        totalCalls?: long(name='TotalCalls', example='100'),
        totalHoldTime?: long(name='TotalHoldTime', example='100'),
        totalLoggedInTime?: long(name='TotalLoggedInTime', example='100'),
        totalOffSiteOnlineTime?: long(name='TotalOffSiteOnlineTime', example='100'),
        totalOfficePhoneOnlineTime?: long(name='TotalOfficePhoneOnlineTime', example='100'),
        totalOnSiteOnlineTime?: long(name='TotalOnSiteOnlineTime', example='100'),
        totalOutboundScenarioReadyTime?: long(name='TotalOutboundScenarioReadyTime', example='100'),
        totalOutboundScenarioTime?: long(name='TotalOutboundScenarioTime', example='100'),
        totalReadyTime?: long(name='TotalReadyTime', example='100'),
        totalTalkTime?: long(name='TotalTalkTime', example='100'),
        totalWorkTime?: long(name='TotalWorkTime', example='100'),
      }(name='Overall'),
      statsTime?: long(name='StatsTime', example='1620291600000'),
    }
  ](name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', example='943D8EF3-3321-471F-A104-51C96FCA94D6'),
}

model ListIntervalAgentSkillGroupReportResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListIntervalAgentSkillGroupReportResponseBody(name='body'),
}

async function listIntervalAgentSkillGroupReportWithOptions(request: ListIntervalAgentSkillGroupReportRequest, runtime: Util.RuntimeOptions): ListIntervalAgentSkillGroupReportResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.agentId)) {
    query['AgentId'] = request.agentId;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.interval)) {
    query['Interval'] = request.interval;
  }
  if (!Util.isUnset(request.mediaType)) {
    query['MediaType'] = request.mediaType;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListIntervalAgentSkillGroupReport',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listIntervalAgentSkillGroupReport(request: ListIntervalAgentSkillGroupReportRequest): ListIntervalAgentSkillGroupReportResponse {
  var runtime = new Util.RuntimeOptions{};
  return listIntervalAgentSkillGroupReportWithOptions(request, runtime);
}

model ListMonoRecordingsRequest {
  contactId?: string(name='ContactId'),
  instanceId?: string(name='InstanceId'),
}

model ListMonoRecordingsResponseBody = {
  code?: string(name='Code'),
  data?: [ 
    {
      agentId?: string(name='AgentId'),
      agentName?: string(name='AgentName'),
      contactId?: string(name='ContactId'),
      duration?: string(name='Duration'),
      fileName?: string(name='FileName'),
      fileUrl?: string(name='FileUrl'),
      ramId?: string(name='RamId'),
      skillGroupId?: string(name='SkillGroupId'),
      startTime?: string(name='StartTime'),
    }
  ](name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model ListMonoRecordingsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListMonoRecordingsResponseBody(name='body'),
}

async function listMonoRecordingsWithOptions(request: ListMonoRecordingsRequest, runtime: Util.RuntimeOptions): ListMonoRecordingsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.contactId)) {
    query['ContactId'] = request.contactId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListMonoRecordings',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listMonoRecordings(request: ListMonoRecordingsRequest): ListMonoRecordingsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listMonoRecordingsWithOptions(request, runtime);
}

model PauseCampaignRequest {
  campaignId?: string(name='CampaignId'),
  instanceId?: string(name='InstanceId'),
}

model PauseCampaignResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: string(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model PauseCampaignResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: PauseCampaignResponseBody(name='body'),
}

async function pauseCampaignWithOptions(request: PauseCampaignRequest, runtime: Util.RuntimeOptions): PauseCampaignResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.campaignId)) {
    query['CampaignId'] = request.campaignId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'PauseCampaign',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function pauseCampaign(request: PauseCampaignRequest): PauseCampaignResponse {
  var runtime = new Util.RuntimeOptions{};
  return pauseCampaignWithOptions(request, runtime);
}

model ProcessAliMeCallbackOfStagingRequest {
  data?: string(name='Data'),
  token?: string(name='Token'),
}

model ProcessAliMeCallbackOfStagingResponseBody = {
  code?: string(name='Code'),
  data?: {
    result?: string(name='Result'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model ProcessAliMeCallbackOfStagingResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ProcessAliMeCallbackOfStagingResponseBody(name='body'),
}

async function processAliMeCallbackOfStagingWithOptions(request: ProcessAliMeCallbackOfStagingRequest, runtime: Util.RuntimeOptions): ProcessAliMeCallbackOfStagingResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.data)) {
    query['Data'] = request.data;
  }
  if (!Util.isUnset(request.token)) {
    query['Token'] = request.token;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ProcessAliMeCallbackOfStaging',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function processAliMeCallbackOfStaging(request: ProcessAliMeCallbackOfStagingRequest): ProcessAliMeCallbackOfStagingResponse {
  var runtime = new Util.RuntimeOptions{};
  return processAliMeCallbackOfStagingWithOptions(request, runtime);
}

model ReplaceMigrationAvailableNumbersRequest {
  instanceId?: string(name='InstanceId'),
  operatorName?: string(name='OperatorName'),
  operatorUid?: long(name='OperatorUid'),
  v1Numbers?: string(name='V1Numbers'),
  v2Numbers?: string(name='V2Numbers'),
}

model ReplaceMigrationAvailableNumbersResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model ReplaceMigrationAvailableNumbersResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ReplaceMigrationAvailableNumbersResponseBody(name='body'),
}

async function replaceMigrationAvailableNumbersWithOptions(request: ReplaceMigrationAvailableNumbersRequest, runtime: Util.RuntimeOptions): ReplaceMigrationAvailableNumbersResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.operatorName)) {
    query['OperatorName'] = request.operatorName;
  }
  if (!Util.isUnset(request.operatorUid)) {
    query['OperatorUid'] = request.operatorUid;
  }
  if (!Util.isUnset(request.v1Numbers)) {
    query['V1Numbers'] = request.v1Numbers;
  }
  if (!Util.isUnset(request.v2Numbers)) {
    query['V2Numbers'] = request.v2Numbers;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ReplaceMigrationAvailableNumbers',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function replaceMigrationAvailableNumbers(request: ReplaceMigrationAvailableNumbersRequest): ReplaceMigrationAvailableNumbersResponse {
  var runtime = new Util.RuntimeOptions{};
  return replaceMigrationAvailableNumbersWithOptions(request, runtime);
}

model ResumeCampaignRequest {
  campaignId?: string(name='CampaignId'),
  instanceId?: string(name='InstanceId'),
}

model ResumeCampaignResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: string(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model ResumeCampaignResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ResumeCampaignResponseBody(name='body'),
}

async function resumeCampaignWithOptions(request: ResumeCampaignRequest, runtime: Util.RuntimeOptions): ResumeCampaignResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.campaignId)) {
    query['CampaignId'] = request.campaignId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ResumeCampaign',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function resumeCampaign(request: ResumeCampaignRequest): ResumeCampaignResponse {
  var runtime = new Util.RuntimeOptions{};
  return resumeCampaignWithOptions(request, runtime);
}

model SaveRTCStatsV2Request {
  callId?: string(name='CallId'),
  generalInfo?: string(name='GeneralInfo'),
  googAddress?: string(name='GoogAddress'),
  instanceId?: string(name='InstanceId'),
  receiverReport?: string(name='ReceiverReport'),
  senderReport?: string(name='SenderReport'),
}

model SaveRTCStatsV2ResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  rowCount?: long(name='RowCount'),
  success?: boolean(name='Success'),
  timeStamp?: long(name='TimeStamp'),
}

model SaveRTCStatsV2Response = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SaveRTCStatsV2ResponseBody(name='body'),
}

async function saveRTCStatsV2WithOptions(request: SaveRTCStatsV2Request, runtime: Util.RuntimeOptions): SaveRTCStatsV2Response {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.callId)) {
    query['CallId'] = request.callId;
  }
  if (!Util.isUnset(request.generalInfo)) {
    query['GeneralInfo'] = request.generalInfo;
  }
  if (!Util.isUnset(request.googAddress)) {
    query['GoogAddress'] = request.googAddress;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.receiverReport)) {
    query['ReceiverReport'] = request.receiverReport;
  }
  if (!Util.isUnset(request.senderReport)) {
    query['SenderReport'] = request.senderReport;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SaveRTCStatsV2',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function saveRTCStatsV2(request: SaveRTCStatsV2Request): SaveRTCStatsV2Response {
  var runtime = new Util.RuntimeOptions{};
  return saveRTCStatsV2WithOptions(request, runtime);
}

model SaveTerminalLogRequest {
  appName?: string(name='AppName'),
  callId?: string(name='CallId'),
  content?: string(name='Content'),
  dataType?: int32(name='DataType'),
  instanceId?: string(name='InstanceId'),
  jobId?: string(name='JobId'),
  methodName?: string(name='MethodName'),
  status?: string(name='Status'),
  uniqueRequestId?: string(name='UniqueRequestId'),
}

model SaveTerminalLogResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  timeStamp?: long(name='TimeStamp'),
}

model SaveTerminalLogResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SaveTerminalLogResponseBody(name='body'),
}

async function saveTerminalLogWithOptions(request: SaveTerminalLogRequest, runtime: Util.RuntimeOptions): SaveTerminalLogResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.callId)) {
    query['CallId'] = request.callId;
  }
  if (!Util.isUnset(request.content)) {
    query['Content'] = request.content;
  }
  if (!Util.isUnset(request.dataType)) {
    query['DataType'] = request.dataType;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.jobId)) {
    query['JobId'] = request.jobId;
  }
  if (!Util.isUnset(request.methodName)) {
    query['MethodName'] = request.methodName;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.uniqueRequestId)) {
    query['UniqueRequestId'] = request.uniqueRequestId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SaveTerminalLog',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function saveTerminalLog(request: SaveTerminalLogRequest): SaveTerminalLogResponse {
  var runtime = new Util.RuntimeOptions{};
  return saveTerminalLogWithOptions(request, runtime);
}

model SaveWebRtcInfoRequest {
  callId?: string(name='CallId'),
  content?: string(name='Content'),
  contentType?: string(name='ContentType'),
  instanceId?: string(name='InstanceId'),
  jobId?: string(name='JobId'),
}

model SaveWebRtcInfoResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  rowCount?: long(name='RowCount'),
  success?: boolean(name='Success'),
  timeStamp?: long(name='TimeStamp'),
}

model SaveWebRtcInfoResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SaveWebRtcInfoResponseBody(name='body'),
}

async function saveWebRtcInfoWithOptions(request: SaveWebRtcInfoRequest, runtime: Util.RuntimeOptions): SaveWebRtcInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.callId)) {
    query['CallId'] = request.callId;
  }
  if (!Util.isUnset(request.content)) {
    query['Content'] = request.content;
  }
  if (!Util.isUnset(request.contentType)) {
    query['ContentType'] = request.contentType;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.jobId)) {
    query['JobId'] = request.jobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SaveWebRtcInfo',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function saveWebRtcInfo(request: SaveWebRtcInfoRequest): SaveWebRtcInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return saveWebRtcInfoWithOptions(request, runtime);
}

model SubmitCampaignRequest {
  campaignId?: string(name='CampaignId'),
  instanceId?: string(name='InstanceId'),
}

model SubmitCampaignResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: string(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model SubmitCampaignResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SubmitCampaignResponseBody(name='body'),
}

async function submitCampaignWithOptions(request: SubmitCampaignRequest, runtime: Util.RuntimeOptions): SubmitCampaignResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.campaignId)) {
    query['CampaignId'] = request.campaignId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SubmitCampaign',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function submitCampaign(request: SubmitCampaignRequest): SubmitCampaignResponse {
  var runtime = new Util.RuntimeOptions{};
  return submitCampaignWithOptions(request, runtime);
}

model UnregisterDeviceRequest {
  instanceId?: string(name='InstanceId'),
  userId?: string(name='UserId'),
}

model UnregisterDeviceResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model UnregisterDeviceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UnregisterDeviceResponseBody(name='body'),
}

async function unregisterDeviceWithOptions(request: UnregisterDeviceRequest, runtime: Util.RuntimeOptions): UnregisterDeviceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UnregisterDevice',
    version = '2020-07-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function unregisterDevice(request: UnregisterDeviceRequest): UnregisterDeviceResponse {
  var runtime = new Util.RuntimeOptions{};
  return unregisterDeviceWithOptions(request, runtime);
}

